package com.etp.db.utils;

import java.beans.PropertyVetoException;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import com.mchange.v2.c3p0.ComboPooledDataSource;

public class DBConnection {
	//private static final Logger log = Logger.getLogger(DBConnection.class.getSimpleName());

	public static ComboPooledDataSource dataSource = new ComboPooledDataSource();

	public static void connectToDB(){
		
		//PropertyConfigurator.configure("log4j.properties");

		try {
			dataSource.setDriverClass( "oracle.jdbc.driver.OracleDriver" );
		} catch (PropertyVetoException e) {
			//log.error(ExceptionUtils.getStackTrace(e));
		}     

		dataSource.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:xe");
		//jdbc:oracle:thin:@localhost:1521:xe", "surya", "surya123
		dataSource.setUser("surya");                                  
		dataSource.setPassword("surya123"); 
		dataSource.setMinPoolSize(5);                                     
		dataSource.setAcquireIncrement(25);
		dataSource.setMaxPoolSize(1000);
		System.out.println("Connected");
	}

	public static void main(String[] args) {
		connectToDB();
	}
}
